function getuserinfo(){
    axios.get('/my/userinfo', {
        // headers: {
        //     Authorization: localStorage.getItem("token"),
        // }
    }).then(({ data: res }) => {
        console.log(res);
        let name = res.data.nickname || res.data.username
        if (res.data.user_pic) {
            $('.avatar').prop('src', res.data.user_pic).show()
        } else {
            $('.text-avatar-box').show()
            $('.text-avatar').html(name[0].toUpperCase())
        }
        $('#welcome').text(`欢迎${name}`)
    })
}
getuserinfo()
// 退出功能
const layer = layui.layer
$('#btnLogout').click(function () {
    layer.confirm('确定退出登录吗?', { icon: 3, title: '提示' }, function (index) {
        localStorage.removeItem('token')
        layer.close(index);
        location.href='/login.html'
    });
})